Skip to content

PlEncoding headers for frequent Pl-objects#110

Draft
mgondan wants to merge 2 commits intoSWI-Prolog:masterfrom
mgondan:master
Draft

PlEncoding headers for frequent Pl-objects#110
mgondan wants to merge 2 commits intoSWI-Prolog:masterfrom
mgondan:master

Conversation

@mgondan
Copy link
Copy Markdown
Contributor

@mgondan mgondan commented Apr 19, 2026

This seems to be on cpp's todo list. Would you please check if I am on the right path? Then I will add a few unit tests and make a few cosmetic changes.

Would you please check if I am on the right path? Then I will add a few unit tests and make a few cosmetic changes.
@mgondan mgondan marked this pull request as draft April 19, 2026 08:20
Comment thread SWI-cpp2.h Outdated
Comment thread SWI-cpp2.h Outdated
Comment thread SWI-cpp2.h
explicit PlModule(const std::string& name)
: WrappedC<module_t>(Plx_new_module(PlAtom(name).unwrap()))
explicit PlModule(const std::string& name, PlEncoding rep=ENC_INPUT)
: WrappedC<module_t>(Plx_new_module(PlAtom(name, rep).unwrap()))
Copy link
Copy Markdown
Member

@kamahen kamahen Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would need to add a Plx_new_module with the additional parameter (which should also default).

@kamahen
Copy link
Copy Markdown
Member

kamahen commented Apr 19, 2026

Please also add test cases for the new methods/functions.

(I'm travelling right now, so I might take a few days to respond)

@mgondan
Copy link
Copy Markdown
Contributor Author

mgondan commented Apr 19, 2026

Would you please check if I am on the right path?

I take your responses as a yes :-)

@kamahen
Copy link
Copy Markdown
Member

kamahen commented Apr 19, 2026

it's probably a good idea to do one function or constructor change all the way through (including a test case) to confirm that the compiler is happy with it (I've been fooled before).

Comment thread SWI-cpp2.cpp Outdated
@mgondan
Copy link
Copy Markdown
Contributor Author

mgondan commented Apr 20, 2026

Added constructors and "compiler" tests such as PlAtom atom(3, "äöü", PlEncoding::UTF8), i.e., just the declarations, no tests so far.

Happy to hear your feedback. I will continue thereafter.

@kamahen
Copy link
Copy Markdown
Member

kamahen commented Apr 21, 2026

If you don't have a test that uses a constructor (or function), then the compiler won't do all the semantic checks because it won't generate any code.

BTW, one of my earlier comments was wrong -- you shouldn't make any changes to SWI-cpp2-plx.h unless there has been a change to SWI-Prolog.h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants